package com.itheima_1;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        /*MyThread t1=new MyThread("张帆");
        MyThread t2=new MyThread("曹云");
       *//* t1.setName("张帆");
        t2.setName("曹云");*//*
        t1.start();
        t2.start();*/
        MyCallable mc=new MyCallable();
        FutureTask<String> ft=new FutureTask<>(mc);
        Thread t1=new Thread(ft);
        t1.setName("飞机");
        t1.setPriority(10);
        //System.out.println(t1.getPriority());//默认优先级为5
        t1.start();
       // System.out.println(ft.get());
        MyCallable mc2=new MyCallable();
        FutureTask<String> ft2=new FutureTask<>(mc2);
        Thread t2=new Thread(ft2);
        t2.setName("坦克");
        t2.setPriority(2);
        // System.out.println(t2.getPriority());//默认优先级为5
        t2.start();
    }
}
